<template name="diy_swiper">
	<view>
		 <u-swiper 
		            :list="list"
					keyName="src"
					:indicator="config.indicator==1?true:false"
					:indicatorMode="config.indicatorMode"
					:circular="true"
					:previousMargin="config.type==1?0:30"
					:nextMargin="config.type==1?0:30"
					:showTitle="config.showTitle==1?true:false"
		            :autoplay="config.autoplay==1?true:false"
					:interval="config.interval"
					:height="config.height+'rpx'"
					:imgMode="config.imgMode"
					:radius="config.radius"
					@click="click"
				
		    ></u-swiper>
	</view>
</template>

<script>
	export default {
		name:"diy-swiper",
		data() {
			return {
				 list:[],
				 config:{
					 list:[],
					 type:1,//1是普通样式，2是卡片样式
					 showTitle:1,
					  height:250,//高度
					 autoplay:1,//是否自动切换
					 interval:3000,//循环间隔时间
					
					 indicator:1,//是否显示指示器
					 indicatorMode:'line',//指示器样式，可选：dot
					 imgMode:"aspectFill",
					 radius:4,//圆角
				 }
			};
		},props:{
			set:{
				type:Object,
				default:{}
			}
		},created() {
			for(let k in this.set.list){
				if(this.set.list[k]['type']=='video'){
					this.set.list[k]['src'] = this.set.list[k]['src_video'];
				}
				this.list.push(this.set.list[k])
			}
			this.config = Object.assign(this.config, this.set)
		}
		,methods:{
			click(k){
				if(this.list[k]&&this.list[k].url.length){
					this.navto(this.list[k].url)
				}
			}
		}
	}
</script>

<style>

</style>